﻿
using GCC.Container.Abstracts;

namespace Z.Test.BlendMode
{
    public class JobDemo : AbsJobBase
    {
        public JobDemo(AbsGCCLogger logger) : base(logger)
        {
            //Interval = new TimeSpan(0, 0, 1);
            //base.JobType = GCCJobTypeEnum.Singleton;
            //base.TimerType = GCCJobTimerTypeEnum.Dependent;
        }

        public override Task Start(AbsGCCContext context)
        {
            return Task.Run(async () =>
            {
                //context.SaveTrace("发送MQ", "发给TestQueue", "/", "", "我是JobDemo", "我发送了aaaaaa");
                //var res = context.SendMessageToLocalMQ("aaaaaa", "testQueue");
                //context.SaveTrace("发送MQ", "发给TestQueue", "/", "", "我是JobDemo", $"我发送了aaaaaa{(res ? "成功" : "失败")}了");
            }, _cancellToken.Token);
        }

        public override Task Stop()
        {
            return Task.Run(() =>
            {
                Logger.Information($"Job {Name} stoping.");
                _cancellToken.Cancel();
                Logger.Information($"Job {Name} stoped.");
            });
        }
    }
}
